package com.ittest.service.impl.rabbitmq.topic.config;



import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class RabbitConfigTopic {


    //消息队列
    @Bean
    public Queue topicqueue(){
        return new Queue("topic_queue");
    }
    //消息队列2
    @Bean
    public Queue topicqueue2(){
        return new Queue("topic_queue2");
    }

    //交换机
    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange("topicExchange");
    }

    @Bean
    //将交换机和消息队列绑定
    public Binding bindingDricet(){
        return BindingBuilder.bind(topicqueue()).to(topicExchange()).with("topic.*.id");
    }
    @Bean
    //将交换机和消息队列绑定
    public Binding bindingDricet2(){
        return BindingBuilder.bind(topicqueue2()).to(topicExchange()).with("topic.orders.*");
    }

}
